<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="../../common/taglibs.jsp"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html:html>
<head>
	<base href="<%=basePath%>">
	<link rel="stylesheet" href="css/screen.css" type="text/css"></link>
	<style type="text/css">
#ejiaA1 {
	width: 550px;
	border-top: #E3E3E3 1px solid;
	border-left: #E3E3E3 1px solid;
}

#ejiaA1 td,#ejiaA1 th {
	padding: 5px;
	border-right: #E3E3E3 1px solid;
	border-bottom: #E3E3E3 1px solid;
	font-size: 12px;
	height: 16px;
	line-height: 16px;
}

#ejiaA1 tr td span {
	color: #686868
}

#ejiaA1 tr td span.st1 {
	color: #ff0000
}
</style>
	<script type="text/javascript" src="js/jquery/jquery-1.7.2.js"></script>
	<script language="javascript">
	
	
$(function() {
	   $.ajax({
				 type: 'get',
				 url: "plan/PlanRetailerAction.do",
				 data: {method: "getRetailerTypeList"},
				 success: function(CreturnDate){ 
				 console.log(CreturnDate);
				 var returnDate=eval('(' + CreturnDate + ')');
				
				 var i;
				 for(i=0;i<returnDate.length;i++){
					 $("#retailType").append("<option value='"+returnDate[i].retailerTypeId+"'>"+returnDate[i].retailerTypeName+"</option>")
				 }
 				}
 			});
   $("#abSearch").click(
   	  function() {
       var retailNo=$("#retailNo").val();
       var retailName=$("#retailName").val();
       var retailType=$("#retailType").val();
       var city=$("#city").val();
       if(retailNo==null && retailName==null && retailType==null &&  city==null ){
           alert("请输入条件");
       }else{
        searchForm.submit();
        //todo
       }
       
   });
});
function ejiaA1(o,a,b,c,d){
var t=document.getElementById(o).getElementsByTagName("tr");
for(var i=1;i<t.length;i++){
	t[i].style.backgroundColor=(t[i].sectionRowIndex%2==0)?a:b;
	t[i].onclick=function(){
	    if($(this).attr("pId")=="1"){
	   		 this.style.backgroundColor=c;	
			$(this).attr("pId","0");
	    }else{
			this.style.backgroundColor=d;	
			$(this).attr("pId","1");}
	}
  }
}
$(function() {
	$("#confirm").click(function() {
	var arrayId = new Array();
	var arrayName = new Array();
	var arrayLoop = new Array();
		$('#ejiaA1 >tbody >tr[pId!="0"]').each(
		function() {
		       arrayId.push($.trim(this.getElementsByTagName("td")[0].innerHTML));	
		       arrayName.push($.trim(this.getElementsByTagName("td")[1].innerHTML));		
		       arrayLoop.push($.trim(this.getElementsByTagName("td")[2].innerHTML));		
		});
		var returnValue={id:arrayId,name:arrayName,loop:arrayLoop};
		window.returnValue=returnValue;
		window.close();
	});
});
</script>
</head>
<body>
	<div style="margin-left: 8px; margin-top: 8px; margin-right: 8px;">
		<h3>
			零售商选择
		</h3>
		<form id="searchForm" action="plan/PlanRetailerAction.do?method=getRetailerList" method="post"  >
			<table class="pattern-elementGroup" width="100%">
				<tbody>
					<tr>
						<td>
							<table cellpadding="1" cellspacing="1" border="1" class="row">
								<tr>
									<td width="100">
										<table cellpadding="0" cellspacing="0" border="0" width="100%">
											<tbody>
												<tr valign="top">
													<td class="label" style="width: 50px;">
														<label>
															店编号
														</label>
													</td>
													<td>
													    <input  id="retailNo" type="text" value="" size="5">
													</td>
												</tr>
											</tbody>
										</table>
									</td>
									<td width="100">
										<table cellpadding="0" cellspacing="0" border="0" width="100%">
											<tbody>
												<tr valign="top">
													<td class="label" style="width: 50px;">
														<label >
															店名
														</label>
													</td>
													<td>
														 <input  id="retailName" type="text" value="" size="5">
													</td>
												</tr>
											</tbody>
										</table>
									</td>
									<td width="100">
										<table cellpadding="0" cellspacing="0" border="0" width="100%">
											<tbody>
												<tr valign="top">
													<td class="label" style="width: 80px;">
														<label>
															店类别
														</label>
													</td>
													<td>
													  <select id="retailType" >
													  	
													  </select>
													</td>
												</tr>
											</tbody>
										</table>
									</td>
									<td width="100">
										<table cellpadding="0" cellspacing="0" border="0" width="100%">
											<tbody>
												<tr valign="top">
													<td class="label" style="width: 50px;">
														<label>
															城市
														</label>
													</td>
													<td>
													 	 <input  id="city" type="text" value="" size="5">
													</td>
												</tr>
											</tbody>
										</table>
									</td>
									<td width="10%" style="padding-left: 10px;">
										 <input  id="abSearch" type="submit" value="搜索">
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</tbody>
			</table>
		</form>
		<div style="margin-top: 10px;">
			<table id="ejiaA1" class="simple">
				<thead>
					<tr>
						<td width="100">
							店编号
						</td>
						<td width="100">
							店名
						</td>
						<td width="100">
							零售店类别
						</td>
						<td width="100">
							城市
						</td>
						<td width="100">
							路径
						</td>
						<td width="100">
							地址
						</td>
					</tr>
				</thead>
				<tbody>
				<logic:present name="planRetailerForm" scope="request">
					<logic:iterate id="retailerList" name="planRetailerForm" property="retailerList">
					  <tr pId="0">
						<td width="100">
							<bean:write name='retailerList' property='retailNo' />
						</td>
						<td width="100">
							<bean:write name='retailerList' property='retailName' />
						</td>
						<td width="100">
							<bean:write name='retailerList' property='retailType' />
						</td>
						<td width="100">
							<bean:write name='retailerList' property='city' />
						</td>
						<td width="100">
							<bean:write name='retailerList' property='loop' />
						</td>
						<td width="100">
							<bean:write name='retailerList' property='addr' />
						</td>
					</tr>
					</logic:iterate>
			   </logic:present>
				</tbody>
			</table>
		</div>
		<table width="100%" cellspacing="0" cellpadding="0" border="0"
			class="buttons">
			<tbody>
				<tr valign="bottom">
					<td class="left" nowrap="nowrap">
						<input name="confirm" id="confirm" value="确定" style="color: black"
							type="button">
					</td>
					<td width="70%">
						&nbsp;
					</td>
					<td align="right" nowrap="nowrap">
						<input name="refuse" id="refuse" value="取消" style="color: black"
							type="button">
					</td>
				</tr>
			</tbody>
		</table>
	</div>
</body>
<script language="javascript">
//ejiaA1("名称","奇数行背景","偶数行背景","鼠标经过背景","点击后背景");
ejiaA1("ejiaA1","#fff","#F5F5F5","#FFFFCC","#0066CC");
</script>
</html:html>
